From bb4adad4e121150f2a17cf6b2fdbfc1cbee39f1c Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Tue, 1 May 2007 10:16:26 +0100 Subject: [PATCH] save/restore: If ENABLE_LOGDIRTY fails, it may be because it is already active. To find out, attempt to disable and then reenable the mode. Signed-off-by: Brendan Cully --- tools/libxc/xc_domain_save.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 49fd25b9b6..32002e0017 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -880,8 +880,17 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY, NULL, 0, NULL, 0, NULL) < 0 ) { - ERROR("Couldn't enable shadow mode"); - goto out; + /* log-dirty already enabled? There's no test op, + so attempt to disable then reenable it */ + if ( !(xc_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF, + NULL, 0, NULL, 0, NULL) >= 0 && + xc_shadow_control(xc_handle, dom, + XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY, + NULL, 0, NULL, 0, NULL) >= 0) ) + { + ERROR("Couldn't enable shadow mode"); + goto out; + } } if ( hvm ) -- 2.30.2